home *** CD-ROM | disk | FTP | other *** search
- // the implementation of class CAptChgPinDialog
- // Copyright (C) 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
-
- #include "../stdafx.h"
-
- #include "aptpin.h"
-
- BEGIN_MESSAGE_MAP(CAptChgPinDialog, CAptCommonDialog)
- END_MESSAGE_MAP()
-
- CEdit& CAptChgPinDialog::ctlWidth(void)
- {
- return *(CEdit*)GetDlgItem(IDC_WIDTH);
- }
-
- CEdit& CAptChgPinDialog::ctlHeight(void)
- {
- return *(CEdit*)GetDlgItem(IDC_HEIGHT);
- }
-
- CEdit& CAptChgPinDialog::ctlDrill(void)
- {
- return *(CEdit*)GetDlgItem(IDC_DRILL);
- }
-
- void CAptChgPinDialog::SetAll(const APERTURE& apt)
- {
- CheckRadioButton(IDC_ROUND, IDC_RECTANGLE, IDC_ROUND + apt.type());
- SetTextInt(&ctlWidth (), apt.width ());
- SetTextInt(&ctlHeight(), apt.height());
- SetTextInt(&ctlDrill (), apt.drill ());
- }
-
- CAptChgPinDialog::CAptChgPinDialog(
- CWnd* pParentWnd,
- const APT_TABLE& apt_table,
- const APT_TABLE& apt_table_purged,
- const APERTURE& prev
- )
- : CAptCommonDialog(pParentWnd, IDD_APTCHG_PIN, apt_table, apt_table_purged, prev),
- m_width (1),
- m_height (1),
- m_drill (1)
- {
- }
-
- BOOL CAptChgPinDialog::OnInitDialog(void)
- {
- CDialog::OnInitDialog();
-
- ctlWidth ().LimitText(5);
- ctlHeight().LimitText(5);
- ctlDrill ().LimitText(5);
-
- RegisterAllItems();
- if(m_apt_table.size() != 0) {
- SetAll(m_apt_table[m_index]);
- ctlExisting().SetCurSel(m_index);
- }
-
- return TRUE;
- }
-
- void CAptChgPinDialog::OnOK(void)
- {
- CDialog::OnOK();
- if((m_type == APERTURE::APT_ROUND )
- || (m_type == APERTURE::APT_SQUARE)) {
- m_height = 0;
- }
- m_aperture.set_all(m_type,
- unit_change_micron2kban(m_width),
- unit_change_micron2kban(m_height),
- unit_change_micron2kban(m_drill)
- );
- if(!m_apt_table.is_included(m_aperture)) {
- m_apt_table.push_back(m_aperture);
- m_apt_table.sort();
- }
- }
-
- void CAptChgPinDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Radio (pDX, IDC_ROUND, m_type);
- DDX_Text (pDX, IDC_WIDTH, m_width);
- DDV_MinMaxInt(pDX, m_width, 1, 10000);
- DDX_Text (pDX, IDC_HEIGHT, m_height);
- DDV_MinMaxInt(pDX, m_height, 0, 10000);
- DDX_Text (pDX, IDC_DRILL, m_drill);
- DDV_MinMaxInt(pDX, m_drill, 0, 10000);
- DDX_LBIndex (pDX, IDC_EXISTING, m_index);
- }
-
- void CAptChgPinDialog::AddAperture(const APERTURE& apt)
- {
- char str[50];
- sprintf(str, "%-9s %4d:%4d,%4d",
- apt.type_name(),
- apt.width(),
- apt.height(),
- apt.drill()
- );
- ctlExisting().AddString(str);
- }
-